﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ArchSoft
{
    public partial class NewDrawingDialog : Form
    {
        public NewDrawingDialog()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {            
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        public int NumberOfFiles
        {
            get
            {
                return (int)numericUpDown1.Value;
            }
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            if (this.numericUpDown1.Value > 10)
            {
                //MessageBox.Show("Maximize value is 10.", "Note", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MessageBox.Show("Giá trị lớn nhất là 10.", "Ghi chú", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.numericUpDown1.Value = 10;
                this.numericUpDown1.Focus();
            }
        }

        private void numericUpDown1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (numericUpDown1.Text != "" && int.Parse(numericUpDown1.Text) > 10)
            {
                //MessageBox.Show("Maximize value is 10.", "Note", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MessageBox.Show("Giá trị lớn nhất là 10.", "Ghi chú", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.numericUpDown1.Text = "10";
                this.numericUpDown1.Value = 10;
                this.numericUpDown1.Focus();
            }
        }       
    }
}